import { defineConfig } from "vite";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import vue from "@vitejs/plugin-vue";
import viteCompression from 'vite-plugin-compression';
const { resolve } = require("path");
// https://vitejs.dev/config/
export default defineConfig({
  base: process.env.NODE_ENV == "development" ? "./" : "./", //访问路径
  plugins: [
    vue(),
    viteCompression(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
  ],
  resolve: {
    alias: {
      "@": resolve("src"),
      "@img": resolve("src/assets/images"),
      comps: resolve("src/components"),
    },
    dedupe: ["vue"],
  },
  css: {
    preprocessorOptions: {
      scss: {
        charset: false,
        // additionalData: `@use "@/assets/css/userTheme.scss" as *; @import "@/assets/css/mixins.scss";`
        additionalData: `@import "@/assets/css/mixins.scss";`,
      },
    },
  },
});
